const [sourcePage, sourcePosition] = this._grid.getItemPosition(source);
let [targetPage, targetPosition, dragLocation] = this._grid.getDropTarget(x, y);
+ let reflowDirection = Clutter.ActorAlign.END;
+
+ if (sourcePosition === targetPosition)
+ reflowDirection = -1;
+
+ if (sourcePage === targetPage && sourcePosition < targetPosition)
+ reflowDirection = Clutter.ActorAlign.START;
+ if (!this._grid.layout_manager.allow_incomplete_pages && sourcePage < targetPage)
+ reflowDirection = Clutter.ActorAlign.START;
+
// In case we're hovering over the edge of an item but the
// reflow will happen in the opposite direction (the drag
// can't "naturally push the item away"), we instead set the
// or last column though, in that case there is no adjacent
// icon we could push away.
if (dragLocation === IconGrid.DragLocation.START_EDGE &&
- targetPosition > sourcePosition &&
- targetPage === sourcePage) {
+ reflowDirection === Clutter.ActorAlign.START) {
const nColumns = this._grid.layout_manager.columns_per_page;
const targetColumn = targetPosition % nColumns;
dragLocation = IconGrid.DragLocation.END_EDGE;
}
} else if (dragLocation === IconGrid.DragLocation.END_EDGE &&
- (targetPosition < sourcePosition ||
- targetPage !== sourcePage)) {
+ reflowDirection === Clutter.ActorAlign.END) {
const nColumns = this._grid.layout_manager.columns_per_page;
const targetColumn = targetPosition % nColumns;